package cz.proks.easyhelpdesk.gwt.event;

import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;

import cz.proks.easyhelpdesk.api.model.Helpdesk;
import cz.proks.easyhelpdesk.api.model.User;

public class MemberDeleteFromHelpdeskEvent extends GwtEvent<MemberDeleteFromHelpdeskEvent.Handler>{
    public final static Type<MemberDeleteFromHelpdeskEvent.Handler> TYPE = new Type<MemberDeleteFromHelpdeskEvent.Handler>();
    
    public static interface Handler extends EventHandler {
        void onMemberDeleteFromHelpdesk(MemberDeleteFromHelpdeskEvent event);
    }
    
    private final Helpdesk helpdesk;
    private final User user;

    public MemberDeleteFromHelpdeskEvent(Helpdesk helpdesk, User user) {
        super();
        this.helpdesk = helpdesk;
        this.user = user;
    }
    
    public static void fireEvent(HasMemberDeleteFromHelpdeskHandlers source, Helpdesk helpdesk, User user) {
        source.fireEvent(new MemberDeleteFromHelpdeskEvent(helpdesk, user));
    }
    
    public Helpdesk getHelpdesk() {
        return helpdesk;
    }
    
    public User getMember() {
        return user;
    }

    @Override
    public com.google.gwt.event.shared.GwtEvent.Type<Handler> getAssociatedType() {
        return TYPE;
    }

    @Override
    protected void dispatch(Handler handler) {
        handler.onMemberDeleteFromHelpdesk(this);
    }    
}
